<template>
  <div class="personalized">
    <div class="image">
      <img
        :src="item.picUrl + '?imageView=1&type=webp&thumbnail=247x0'"
        alt=""
      />
      <span>
        <h1></h1>
        {{ playCount }}</span
      >
    </div>
    <h3>{{ item.name }}</h3>
  </div>
</template>

<script>
export default {
  name: "Personalized",
  props: ["item"],
  computed: {
    playCount() {
      return Math.floor(this.item.playCount / 10000) > 0
        ? Math.floor(this.item.playCount / 10000) + "万"
        : this.item.playCount;
    },
  },
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped lang="less">
.personalized {
  width: calc(100vw / 3 - 10px);
  margin-bottom: 16px;
  .image {
    height: calc(100vw / 3 - 5px);
    position: relative;
    background-image: url("../assets/loading.gif");
    background-color: rgba(0, 0, 0, 0.5);
    background-size: cover;
    width: 100%;
    background-position: center;
    &::after {
      content: "";
      display: block;
      position: absolute;
      left: 0;
      top: 0;
      width: 100%;
      height: 18px;
      // z-index: ;
      background-image: linear-gradient(
        90deg,
        rgba(0, 0, 0, 0),
        rgba(0, 0, 0, 0.2)
      );
    }
    img {
      width: 100%;
      height: auto;
      vertical-align: middle;
    }
    span {
      position: absolute;
      top: 2px;
      right: 5px;
      color: #fff;
      font-size: 12px;
      text-shadow: 1px 0 0 rgba(0, 0, 0, 0.15);
      display: flex;
      align-items: center;
      z-index: 2;
      h1 {
        display: inline-block;
        margin-right: 2px;
        width: 10px;
        height: 10px;
        background-image: url("");
        background-size: 100%;
        background-position: center;
        background-repeat: no-repeat;
      }
    }
  }
  h3 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    font-size: 13px;
    padding: 6px 2px 0 6px;
    line-height: 1.2;
    overflow: hidden;
  }
}
</style>
